﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ImgProcessGui
{
    class GetParams
    {        
        public int[] ParselUMinMax(string title)
        {
            string[] userInputParsed;
            char[] seperator={',',':'};
            Console.WriteLine("");
            Console.WriteLine(title);
            Console.WriteLine("Write <MinVec0,MaxVec0,MinVal0,MaxVal0:MinVec1,MaxVec1,MinVal1,MaxVal1:...>");
            userInputParsed = Console.ReadLine().Split(seperator);
            int[] returnedArr = new int[userInputParsed.Length];
            for (int i = 0; i < userInputParsed.Length; i++)
            {
                returnedArr[i] = Convert.ToInt32(userInputParsed[i]);
            }
            return returnedArr;                    
        }
       
    }
    class SortResults
    {
        /// <summary>
        /// Sorting Dictionary by value: smallest to highest value
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static List<KeyValuePair<string, double>> SortDictionary(Dictionary<string,double> data)
        {
            List<KeyValuePair<string, double>> result = new List<KeyValuePair<string, double>>(data);
            result.Sort(delegate(KeyValuePair<string, double> first, KeyValuePair<string, double> second) { return first.Value.CompareTo(second.Value);});
            data.Clear();
            foreach(KeyValuePair<string, double> kvp in result)
            {
                data.Add(kvp.Key, kvp.Value);
            }
            return result;
        }
    }


}
